from utils.response import ResponseModel

class BusinessException(Exception):
    def __init__(self, code: int, message: str):
        self.detail = ResponseModel.error(code=code, message=message)
        super().__init__(self.detail)

class AuthException(BusinessException):
    def __init__(self, message: str = "认证失败"):
        super().__init__(code=401, message=message)

class PermissionException(BusinessException):
    def __init__(self, message: str = "权限不足"):
        super().__init__(code=403, message=message)

class NotFoundException(BusinessException):
    def __init__(self, message: str = "资源不存在"):
        super().__init__(code=404, message=message)

class ParamException(BusinessException):
    def __init__(self, message: str = "参数错误"):
        super().__init__(code=400, message=message) 